﻿CREATE TABLE [dbo].[WorkCategory]
(
	[WorkCategoryId] [int] IDENTITY(1,1) NOT NULL, 
	[WorkLogId] [int] NOT NULL,
    [CategoryId] [int] NOT NULL,
    CONSTRAINT [PK_WorkCategory] PRIMARY KEY CLUSTERED 
    (
	    [WorkCategoryId] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[WorkCategory]  WITH CHECK ADD  CONSTRAINT [FK_WorkCategory_Category] FOREIGN KEY([categoryId])
REFERENCES [dbo].[Category] ([categoryId])
GO

ALTER TABLE [dbo].[WorkCategory] CHECK CONSTRAINT [FK_WorkCategory_Category]
GO

ALTER TABLE [dbo].[WorkCategory]  WITH CHECK ADD  CONSTRAINT [FK_WorkCategory_WorkLog] FOREIGN KEY([worklogId])
REFERENCES [dbo].[WorkLog] ([worklogId])
GO

ALTER TABLE [dbo].[WorkCategory] CHECK CONSTRAINT [FK_WorkCategory_WorkLog]
GO